<template>
  <!--任务状态必须大于0-->

  <div class="completeTask ">
    <div v-if="customData.haveQaAuth||customData.finishedAuth" class="button_btn flex-ec">
      <p v-if="customData.allowAskQuestion == 1 && customData.haveQaAuth " style="width:100%;height:50px;line-height:50px;font-size:17px;padding:0;margin:0" @click="qa">提问</p>
      <p v-if="tableData.taskInfo.isReplay&&customData.feedbackShow&&tableData.taskInfo.taskStatus != 2" style="width:100%;height:50px;line-height:50px;font-size:17px;padding:0;margin:0" class="yellow_btn" @click="feedbackqa">任务反馈</p>
      <p v-if="tableData.taskInfo.isReplay&&customData.feedbackShow&&tableData.taskInfo.taskStatus == 2" style="width:100%;height:50px;line-height:50px;font-size:17px;padding:0;margin:0" class="yellow_btn" @click="seefeedbackqa">任务反馈</p>
      <p v-if="tableData.taskInfo.taskStatus != 2 && customData.finishedAuth" style="width:100%;height:50px;line-height:50px;font-size:17px;padding:0;margin:0" class="blue_btn" @click="completeTask">提交结果</p>
      <p v-if="tableData.taskInfo.taskStatus == 2" style="width:100%;height:50px;line-height:50px;font-size:17px;padding:0;margin:0" class="ash_btn">已提交</p>
    </div>
    <div v-else class="button_btn flex-ec">
      <p v-if="tableData.taskInfo.isReplay&&customData.feedbackShow&&tableData.taskInfo.taskStatus != 2 " style="width:100%;height:50px;line-height:50px;font-size:17px;padding:0;margin:0" class="yellow_btn" @click="feedbackqa">任务反馈</p>
      <p v-if="tableData.taskInfo.isReplay&&customData.feedbackShow&&tableData.taskInfo.taskStatus == 2" style="width:100%;height:50px;line-height:50px;font-size:17px;padding:0;margin:0" class="yellow_btn" @click="seefeedbackqa">任务反馈</p>
    </div>

    <!-- 回复模板 -->
    <template>
      <div v-if="replyShow" class="finish ">
        <div class="finishContent ">
          <div class="title">任务反馈</div>
          <div class="finishbody">
            <template>
              <el-form ref="form" :model="form" label-position="top">
                <div v-for="(item,index) in tableData.templateCompList" :key="index">
                  <el-form-item v-if="item.editType == 0 && item.mustInput == 0 " :label="item.compName">
                    <!--短文本-->
                    <el-input v-model="item.compValue" type="text" />
                  </el-form-item>
                  <el-form-item v-if="item.editType == 0 && item.mustInput == 1 " :label="item.compName" :rules="[{ required:true,message:'填写内容不能为空'}]">
                    <!--短文本-->
                    <el-input v-model="item.compValue" type="text" />
                  </el-form-item>
                  <el-form-item v-if="item.editType == 1 && item.mustInput == 0 " :label="item.compName">
                    <!--单选-->
                    <div class="radiosListstSylke flex-ss">
                      <div v-for="(items,indexs) in item.templateCompValuesList" :key="indexs" class="addRadios mr15">
                        <el-radio v-model="item.compRadioValue" :label="items.compValueId">{{ items.compValueName }}</el-radio><!-- @change.native.prevent="radioChecked(indexs,item.templateCompValuesList,indexs)"-->
                      </div>
                    </div>
                  </el-form-item>
                  <el-form-item v-if="item.editType == 1 && item.mustInput == 1 " :label="item.compName" :rules="[{ required:true,message:'选择内容不能为空'}]">
                    <!--单选-->
                    <div class="radiosListstSylke flex-ss">
                      <div v-for="(items,indexs) in item.templateCompValuesList" :key="indexs" class="addRadios mr15">
                        <el-radio v-model="item.compRadioValue" :label="items.compValueId">{{ items.compValueName }}</el-radio><!-- @change.native.prevent="radioChecked(indexs,item.templateCompValuesList,indexs)"-->
                      </div>
                    </div>
                  </el-form-item>
                  <el-form-item v-if="item.editType == 2 && item.mustInput == 0 " :label="item.compName">
                    <!--多选-->
                    <div class="checkboxListstSylke flex-ss mr10">
                      <div v-for="(items,indexs) in item.templateCompValuesList" :key="indexs" class="addcheckboxs mr15">
                        <el-checkbox v-model="item.compCheckboxpValue" :label="items.compValueId">{{ items.compValueName }}</el-checkbox>
                      </div>
                    </div>
                  </el-form-item>
                  <el-form-item v-if="item.editType == 2 && item.mustInput == 1 " :label="item.compName" :rules="[{ required:true,message:'选择内容不能为空'}]">
                    <!--多选-->
                    <div class="checkboxListstSylke flex-ss mr10">
                      <div v-for="(items,indexs) in item.templateCompValuesList" :key="indexs" class="addcheckboxs mr15">
                        <el-checkbox v-model="item.compCheckboxpValue" :label="items.compValueId">{{ items.compValueName }}</el-checkbox><!-- @change.native.prevent="checkboxChecked(indexs,item.templateCompValuesList,index)"----->
                      </div>
                    </div>
                  </el-form-item>
                  <el-form-item v-if="item.editType == 3 && item.mustInput == 0 " :label="item.compName">
                    <!--长文本-->
                    <el-input v-model="item.compValue" type="textarea" />
                  </el-form-item>
                  <el-form-item v-if="item.editType == 3 && item.mustInput == 1 " :label="item.compName" :rules="[{ required:true,message:'填写不能为空'}]">
                    <!--长文本-->
                    <el-input v-model="item.compValue" type="textarea" />
                  </el-form-item>
                  <el-form-item v-if="item.editType == 4 && item.mustInput == 0 " :label="item.compName">
                    <!--时间-->
                    <p class="timeData" @click="settime(item,3)">{{ item.compValue }}</p>
                  </el-form-item>
                  <el-form-item v-if="item.editType == 4 && item.mustInput == 1 " :label="item.compName" :rules="[{ required:true,message:'时间不能为空'}]">
                    <!--时间-->
                    <p class="timeData" @click="settime(item,3)">{{ item.compValue }}</p>
                  </el-form-item>
                  <el-form-item v-if="item.editType == 5 && item.mustInput == 0 " :label="item.compName">
                    <!-- 附件-->
                    <el-upload v-if="!item.newFileName" :ref="'upload'+index" class="upload-demo flex-sc" :limit="1" multiple action="http://192.168.10.117:8081/wtmapi/taskattachment/uploadAttachment" :on-remove="handleRemove" :auto-upload="false" :on-change="beforeAvatarUpload">
                      <el-button slot="trigger" size="small" type="primary" round @click="empty(item)">选取文件</el-button>
                      <el-button style="margin-left: 10px;" size="small" type="primary" round @click="TemplateUpload(item,index)">上传到服务器</el-button>
                    </el-upload>
                    <div v-else class="mbx">
                      <p>{{ item.newFileName }}</p>
                      <el-button slot="trigger" size="mini" type="primary" @click="deleteAttachment(item,index)">删除
                      </el-button>
                    </div>
                  </el-form-item>
                  <el-form-item v-if="item.editType == 5 && item.mustInput == 1 " :label="item.compName" :rules="[{ required:true,message:'上传文件不能为空'}]">
                    <el-upload v-if="!item.newFileName" :ref="'upload'+index" class="upload-demo  flex-sc" :limit="1" multiple action="http://192.168.10.117:8081/wtmapi/taskattachment/uploadAttachment" :on-remove="handleRemove" :auto-upload="false" :on-change="beforeAvatarUpload">
                      <el-button slot="trigger" size="mini" type="primary" round @click="empty(item)">选取文件</el-button>
                      <el-button style="margin-left: 10px;" size="mini" type="primary" round @click="TemplateUpload(item,index)">上传到服务器</el-button>
                    </el-upload>
                    <div v-else class="mbx">
                      <p>{{ item.newFileName }}</p>
                      <el-button slot="trigger" size="mini" type="primary" @click="deleteAttachment(item,index)">删除
                      </el-button>
                    </div>
                  </el-form-item>
                </div>
              </el-form>
            </template>
          </div>
          <div v-if="tableData.taskInfo.taskStatus != 2" class="floot flex-bc">
            <p @click="qictureVisible()">取消</p>
            <p @click="onsubmit()">确定</p>
          </div>
        </div>

      </div>
    </template>

    <!-- 查看回复模板 -->
    <template>
      <div v-if="seereplyShow" class="finish seefinish">
        <div class="finishContent ">
          <div class="title">任务反馈</div>
          <div class="finishbody">
            <template>
              <el-form ref="form" :model="form" label-position="top">
                <div v-for="(item,index) in tableData.templateCompList" :key="index">
                  <el-form-item v-if="item.editType == 0 && item.mustInput == 0 " :label="item.compName">
                    <!--短文本-->
                    <el-input v-model="item.compValue" type="text" disabled />
                  </el-form-item>
                  <el-form-item v-if="item.editType == 0 && item.mustInput == 1 " :label="item.compName" :rules="[{ required:true,message:'填写内容不能为空'}]">
                    <!--短文本-->
                    <el-input v-model="item.compValue" type="text" disabled />
                  </el-form-item>
                  <el-form-item v-if="item.editType == 1 && item.mustInput == 0 " :label="item.compName">
                    <!--单选-->
                    <div class="radiosListstSylke flex-ss">
                      <div v-for="(items,indexs) in item.templateCompValuesList" :key="indexs" class="addRadios mr15">
                        <el-radio v-model="item.compRadioValue" disabled :label="items.compValueId">{{ items.compValueName }}</el-radio><!-- @change.native.prevent="radioChecked(indexs,item.templateCompValuesList,indexs)"-->
                      </div>
                    </div>
                  </el-form-item>
                  <el-form-item v-if="item.editType == 1 && item.mustInput == 1 " :label="item.compName" :rules="[{ required:true,message:'选择内容不能为空'}]">
                    <!--单选-->
                    <div class="radiosListstSylke flex-ss">
                      <div v-for="(items,indexs) in item.templateCompValuesList" :key="indexs" class="addRadios mr15">
                        <el-radio v-model="item.compRadioValue" disabled :label="items.compValueId">{{ items.compValueName }}</el-radio><!-- @change.native.prevent="radioChecked(indexs,item.templateCompValuesList,indexs)"-->
                      </div>
                    </div>
                  </el-form-item>
                  <el-form-item v-if="item.editType == 2 && item.mustInput == 0 " :label="item.compName">
                    <!--多选-->
                    <div class="checkboxListstSylke flex-ss mr10">
                      <div v-for="(items,indexs) in item.templateCompValuesList" :key="indexs" class="addcheckboxs mr15">
                        <el-checkbox v-model="item.compCheckboxpValue" disabled :label="items.compValueId">{{ items.compValueName }}</el-checkbox>
                      </div>
                    </div>
                  </el-form-item>
                  <el-form-item v-if="item.editType == 2 && item.mustInput == 1 " :label="item.compName" :rules="[{ required:true,message:'选择内容不能为空'}]">
                    <!--多选-->
                    <div class="checkboxListstSylke flex-ss mr10">
                      <div v-for="(items,indexs) in item.templateCompValuesList" :key="indexs" class="addcheckboxs mr15">
                        <el-checkbox v-model="item.compCheckboxpValue" disabled :label="items.compValueId">{{ items.compValueName }}</el-checkbox><!-- @change.native.prevent="checkboxChecked(indexs,item.templateCompValuesList,index)"----->
                      </div>
                    </div>
                  </el-form-item>
                  <el-form-item v-if="item.editType == 3 && item.mustInput == 0 " :label="item.compName">
                    <!--长文本-->
                    <el-input v-model="item.compValue" type="textarea" disabled />
                  </el-form-item>
                  <el-form-item v-if="item.editType == 3 && item.mustInput == 1 " :label="item.compName" :rules="[{ required:true,message:'填写不能为空'}]">
                    <!--长文本-->
                    <el-input v-model="item.compValue" type="textarea" disabled />
                  </el-form-item>
                  <el-form-item v-if="item.editType == 4 && item.mustInput == 0 " :label="item.compName">
                    <!--时间-->
                    <p class="timeData" disabled>{{ item.compValue }}</p>
                  </el-form-item>
                  <el-form-item v-if="item.editType == 4 && item.mustInput == 1 " :label="item.compName" :rules="[{ required:true,message:'时间不能为空'}]">
                    <!--时间-->
                    <p class="timeData" disabled>{{ item.compValue }}</p>
                  </el-form-item>
                  <el-form-item v-if="item.editType == 5 && item.mustInput == 0 " :label="item.compName">
                    <!-- 附件-->
                    <div class="mbx">
                      <p>{{ item.newFileName }}</p>
                    </div>
                  </el-form-item>
                  <el-form-item v-if="item.editType == 5 && item.mustInput == 1 " :label="item.compName" :rules="[{ required:true,message:'上传文件不能为空'}]">
                    <div class="mbx">
                      <p>{{ item.newFileName }}</p>
                    </div>

                  </el-form-item>
                </div>
              </el-form>
            </template>
          </div>
          <div class="floot flex-bc">
            <p style="background-color:rgba(0,113,206,1)" @click="qictureVisible()">返回上一页</p>
          </div>
        </div>
      </div>
    </template>
    <div v-show="mobleshow" class="mobleshow" @click="qictureVisible" />
    <!-- setTime START -->
    <WPTX_PICKER :show="show" :link="link" :columns="columns" :default-data="defaultData" :select-data="pickData" @cancel="close" @confirm="confirmFn" />
    <!-- setTime E N D -->
  </div>

</template>
<script>

import { global } from '../../filter/global-api'
import Vue from 'vue'
import VueResource from 'vue-resource'
import _common from '../../framework/commonJs/wptx_common'
import _tools from '../../framework/commonJs/wptx_tools'
import _validate from '../../framework/commonJs/wptx_validate'
import _storewxtaskAPI from '../../framework/API/storewxtaskapi'
import _storepctaskAPI from '../../framework/API/storepctaskAPI'
import _taskstoreitemapi from '../../framework/API/taskstoreitemapi'

import WPTX_PICKER from '../../framework/commonTemplate/picker'
import {
  years,
  month,
  day,
  hours,
  minutes,
  seconds
} from '../../framework/commonTemplate/lib/data'
const _FUNCTION_NAME = _common.pageName.WPTXCOMPLETETASK
export default {

  components: {
    WPTX_PICKER: WPTX_PICKER
  },
  props: {
    taskInfo: {
      type: Object,
      default: {}
    }
  },

  /*         通用数据         */

  data() {
    return {
      userTypegeneral: '', // 副总
      goodShow: false, // 是否显示商品列表
      submitType: 1,

      tableData: {
        templateCompList: [],
        taskInfo: {
          taskStatus: 0, // 任务状态（注：-2：已取消 -1：已撤回 0：待跟进；1：跟进中；2：已完成；3：已超时；,
          doCompleteTaskRight: false // doCompleteTaskRight (boolean, optional): 是否有完成任务权限 ,
        }
      },

      // 时间插件
      show: false,
      columns: 5,
      link: true,
      defaultData: [],
      pickData: {
        data1: years,
        data2: month,
        data3: day,
        data4: hours,
        data5: minutes,
        data6: seconds
      },
      form: {},
      customData: {
        fielData: {},
        itemData: {},
        time: '',
        type: 3,
        storeMgr: false,
        allowAskQuestion: false,
        haveQaAuth: false,
        feedbackShow: false,
        finishedAuth: false
      },
      limit: 1,
      seereplyShow: false,
      replyShow: false,
      mobleshow: false
    }
  },
  // 监听父元素的任务状态
  watch: {
    taskInfo: {
      handler(newName, oldName) {
        this.tableData.taskInfo = newName
      },
      deep: true,
      immediate: true // 最初绑定值是否触发
    }
  },

  mounted() {
    const self = this

    self.tableData.taskInfo = self.taskInfo
    self.customData.storeMgr = _validate.checkBooleanString(sessionStorage.getItem('storeMgr'))
    const datauserType = sessionStorage.getItem('context')
    const dataUser = JSON.parse(datauserType)
    self.userTypegeneral = dataUser.userType
    setTimeout(function() {
      // 本地储存是否允许店长提问
      self.customData.allowAskQuestion = _validate.checkBooleanString(sessionStorage.getItem('allowAskQuestion'))
      // 是否有提问权限
      self.customData.haveQaAuth = _validate.checkBooleanString(sessionStorage.getItem('haveQaAuth'))
      // 是否有完成任务的权限
      self.customData.finishedAuth = _validate.checkBooleanString(sessionStorage.getItem('finishedAuth'))

      self.$forceUpdate()
    }, 300)

    const data = {
      storeId: JSON.parse(sessionStorage.getItem('context')).storeId,
      taskId: self.$route.params.taskId ? self.$route.params.taskId : sessionStorage.getItem('taskId')
    }
    _storepctaskAPI.feedback(self, data, self.callBack_feedbackinfo)
    _taskstoreitemapi.checkDisplay(self, data.storeId + '/' + data.taskId, self.callBack_goodShow)
  },
  methods: {

    /*                     自定义方法                    */

    // 取消回复模板
    qictureVisible() {
      const self = this
      self.seereplyShow = false
      self.replyShow = false
      self.mobleshow = false
      self.submitType = 1
      self.customData.fielData = {}
      self.customData.itemData = {}
      self.tableData.templateCompList = []
      self.defaultData = []
      self.customData.time = ''
    },
    // 保存回复模板
    onsubmit() {
      const self = this

      for (let i = 0; i < self.tableData.templateCompList.length; i++) {
        const item = self.tableData.templateCompList[i]
        if (self.submitType == 1) {
          if (item.mustInput == 1) {
            if (item.editType == 1) {
              if (item.templateCompValuesList == undefined || item.templateCompValuesList == null || item.templateCompValuesList == [] || item.templateCompValuesList.length < 1) {
                _tools.openTip(self, '《' + item.compName + '》为必选项，没有选项值', 'warning')
                return false
              }
              if (item.compRadioValue == '') {
                _tools.openTip(self, '请填写完整回复模板', 'warning')
                return false
              }
            } else if (item.editType == 2) {
              if (item.templateCompValuesList == undefined || item.templateCompValuesList == null || item.templateCompValuesList == [] || item.templateCompValuesList.length < 1) {
                _tools.openTip(self, '《' + item.compName + '》为必选项，没有选项值', 'warning')
                return false
              }
              if ((item.compCheckboxpValue == [] || item.compCheckboxpValue.length < 1)) {
                _tools.openTip(self, '请填写完整回复模板', 'warning')
                return false
              }
            } else {
              if (_validate.checkEmpty(item.compValue)) {
                _tools.openTip(self, '请填写完整回复模板', 'warning')
                return false
              }
            }
          }
        }
        if (item.editType == 1) {
          if (_validate.checkListEmpty(item.templateCompValuesList)) {
            continue
          }
          if (_validate.checkEmpty(item.compRadioValue)) {
            continue
          }
          item.templateCompValuesList.map(items => {
            if (item.compRadioValue == items.compValueId) {
              items.isChecked = 1
            } else {
              items.isChecked = 0
            }
          })
        }
        if (item.editType == 2) {
          if (_validate.checkListEmpty(item.templateCompValuesList)) {
            continue
          }
          if (_validate.checkListEmpty(item.compCheckboxpValue)) {
            continue
          }
          item.templateCompValuesList.map(items => {
            items.isChecked = 0
          })
          item.templateCompValuesList.map(items => {
            item.compCheckboxpValue.map(itemValueId => {
              if (itemValueId == items.compValueId) {
                items.isChecked = 1
              }
            })
          })
        }
      }
      const data = {
        storeId: JSON.parse(sessionStorage.getItem('context')).storeId,
        taskId: sessionStorage.getItem('taskId'),
        submitType: self.submitType,
        taskTemplateList: self.tableData.templateCompList,
        templateId: sessionStorage.getItem('templateId')
      }
      _storewxtaskAPI.taskFeedbackSave(self, data, self.callBack_onsubmit)
    },
    radioChecked(index, list, i) {
      const self = this
      for (var i = 0; i < list.length; i++) {
        list[i].isChecked = 0
      }
      list[index].isChecked = 1
      const templateCompList = self.tableData.templateCompList
      self.tableData.templateCompList = []
      self.tableData.templateCompList = templateCompList
    },
    // 模板的多选按钮
    checkboxChecked(index, list, i) {
      const self = this
      if (list[index].isChecked == 0) {
        list[index].Checked = true
        list[index].isChecked = 1
      } else {
        list[index].Checked = false
        list[index].isChecked = 0
      }

      const templateCompList = self.tableData.templateCompList
      self.tableData.templateCompList = []
      self.tableData.templateCompList = templateCompList
    },
    // 模板项的删除
    deleteAttachment(data, index) {
      const self = this
      data.compValue = ''
      data.newFileName = ''
      data.originalFileName = ''
    },
    // 上传数量控制
    beforeAvatarUpload(file, fileList) {
      fileList.splice(1, fileList.length)
    },
    handleRemove(file, fileList) {
    },
    // 富文本结束
    empty(data) {
      const self = this
      self.customData.fielData = {}
      self.customData.fielData = _tools.cloneObj(data)
    },
    // 上传附件
    TemplateUpload(item, index) {
      const self = this
      const url = 'taskattachment/upload'
      const uploadName = 'upload' + index
      const fileListItemData = self.$refs[uploadName][0].uploadFiles[0].raw
      var formItemData = new FormData()
      formItemData.append(
        'uploadFile',
        fileListItemData,
        fileListItemData.name
      )
      global.post(
        url,
        null,
        null,
        formItemData,
        function(res) {
          if (res.code == 200) {
            _tools.openTip(self, '上传完成', 'success')
            self.tableData.templateCompList.map(item => {
              if (item.compId == self.customData.fielData.compId) {
                item.compValue = res.data.downloadUrl
                item.newFileName = res.data.fileName
                item.originalFileName = res.data.fileName
                self.$refs[uploadName][0].clearFiles()
                self.$forceUpdate()
              }
            })
          }
        },
        function(res) {},
        false,
        true,
        true
      )
    },
    // 打开设置时间插件
    settime(data, value) {
      const self = this
      self.customData.type = value
      self.show = true
      self.columns = 5
      self.link = true
      self.defaultData = []
      self.customData.itemData = {}

      self.customData.itemData = _tools.cloneObj(data)
      if (self.customData.time != null) {
        self.defaultData.push(self.customData.time.select1)
        self.defaultData.push(self.customData.time.select2)
        self.defaultData.push(self.customData.time.select3)
        self.defaultData.push(self.customData.time.select4)
        self.defaultData.push(self.customData.time.select5)
      }
      self.pickData.data1 = years
      self.pickData.data2 = month
      self.pickData.data3 = day
      self.pickData.data4 = hours
      self.pickData.data5 = minutes
    },
    // 选择完时间的返回值
    confirmFn(val) {
      const self = this
      self.show = false
      self.customData.time = _tools.cloneObj(val)
      self.customData.time =
        self.customData.time.select1.text +
        '-' +
        self.customData.time.select2.text +
        '-' +
        self.customData.time.select3.text +
        ' ' +
        self.customData.time.select4.text +
        ':' +
        self.customData.time.select5.text
      self.tableData.templateCompList.map(item => {
        if (item.compId == self.customData.itemData.compId) {
          item.compValue = self.customData.time

          this.$forceUpdate()
        }
      })
    },
    // 关闭选择时间插件
    close() {
      const self = this
      self.show = false
    },
    // 关闭回复模板
    qictureVisible() {
      const self = this
      self.seereplyShow = false
      self.replyShow = false
      self.mobleshow = false
      self.submitType = 1
      self.customData.fielData = {}
      self.customData.itemData = {}
      // self.tableData.templateCompList = [];
      self.defaultData = []
      self.customData.time = ''
    },
    // 跳转提问页面
    qa() {
      const self = this
      self.$router.push({
        name: 'wptx_QAList'
      })
    },
    // 判断是否需要回复
    completeTask(e) {
      const self = this
      if (self.tableData.taskInfo.isReplay == 1) {
        self.replyShow = true
        self.mobleshow = true
        self.submitType = 1
        const data = {
          storeId: JSON.parse(sessionStorage.getItem('context')).storeId,
          taskId: sessionStorage.getItem('taskId')
        }
        _storepctaskAPI.feedback(self, data, self.callBack_feedbackinfo)
      } else {
        this.$emit('completeTask')
        e.preventDefault()
      }
    },
    // 任务反馈
    feedbackqa() {
      const self = this
      if (_validate.checkListEmpty(self.tableData.templateCompList)) {
        _tools.openTip(self, '回复模板为空', 'warning')
      }
      self.submitType = 2,
      self.replyShow = true
      self.mobleshow = true
      const data = {
        storeId: JSON.parse(sessionStorage.getItem('context')).storeId,
        taskId: sessionStorage.getItem('taskId')
      }
      _storepctaskAPI.feedback(self, data, self.callBack_feedbackinfo)
    },
    // 任务反馈
    seefeedbackqa() {
      const self = this
      if (_validate.checkListEmpty(self.tableData.templateCompList)) {
        _tools.openTip(self, '回复模板为空', 'warning')
      }
      self.seereplyShow = true
      self.mobleshow = true
      const data = {
        storeId: JSON.parse(sessionStorage.getItem('context')).storeId,
        taskId: sessionStorage.getItem('taskId')
      }
      _storepctaskAPI.feedback(self, data, self.callBack_feedbackinfo)
    },
    callBack_onsubmit(data) {
      const self = this
      self.replyShow = false
      self.mobleshow = false
      self.customData.fielData = {}
      self.customData.itemData = {}
      // self.tableData.templateCompList = [];
      self.defaultData = []
      self.customData.time = ''
      if (self.submitType == 1) {
        this.$emit('completeTask')
      }
    },
    callBack_feedbackinfo(data) {
      const self = this
      if (_validate.checkListEmpty(data)) {
        self.tableData.templateCompList = []
        return
      }
      self.customData.feedbackShow = true
      for (let i = 0; i < data.length; i++) {
        const item = data[i]
        if (item.editType == 1) {
          if (_validate.checkListEmpty(item.templateCompValuesList)) {
            item.compRadioValue = ''
            continue
          }
          item.compRadioValue = ''
          item.templateCompValuesList.map(items => {
            if (items.isChecked == 1) {
              item.compRadioValue = items.compValueId
            }
          })
        } else if (item.editType == 2) {
          if (_validate.checkListEmpty(item.templateCompValuesList)) {
            item.compCheckboxpValue = []
            continue
          }
          item.compCheckboxpValue = []
          item.templateCompValuesList.map(items => {
            if (items.isChecked == 1) {
              item.compCheckboxpValue.push(items.compValueId)
            }
          })
        }
      }
      self.tableData.templateCompList = data
    },
    callBack_feedback(data) {
      const self = this
      if (_validate.checkListEmpty(data.taskTemplateList)) {
        self.tableData.templateCompList = []
        return
      }
      self.customData.feedbackShow = true
      for (let i = 0; i < data.length; i++) {
        const item = data.taskTemplateList[i]
        if (item.editType == 1) {
          if (_validate.checkListEmpty(item.templateCompValuesList)) {
            item.compRadioValue = ''
            continue
          }
          item.compRadioValue = ''
          item.templateCompValuesList.map(items => {
            if (items.isChecked == 1) {
              item.compRadioValue = items.compValueId
            }
          })
        } else if (item.editType == 2) {
          if (_validate.checkListEmpty(item.templateCompValuesList)) {
            item.compCheckboxpValue = []
            continue
          }
          item.compCheckboxpValue = []
          item.templateCompValuesList.map(items => {
            if (items.isChecked == 1) {
              item.compCheckboxpValue.push(items.compValueId)
            }
          })
        }
      }
      self.tableData.templateCompList = data.taskTemplateList
    },
    callBack_goodShow(res) {
      const self = this
      self.goodShow = res
    }
  }
}
</script>
<style>
.completeTask {
  width: 100%;
  flex: none;
  padding: 0!important;
  height: 50px;
  box-sizing: border-box;
  font-size: 10px;
  z-index: 99;

  background-color: #fff;
}
.button_btn {
  width: 100%;
  height:50px;
}
.button_btn p{
  flex:1;
  font-size: 17px;
  padding:0;
  height:50px;
  margin:0;
  border-radius:0px!important;
  line-height: 50px;
  text-align:center;
}
.mobleshow {
  position: fixed;
  top: 0px;
  left: 0px;
  height: 100%;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 888888;
}
.finish {
  position: fixed;
  top: 0px;
  left: 0px;
  height: 100%;
  width: 100%;
  background-color: #fff;
  z-index: 999999999;
}
.el-radio__label {
  padding-left: 5px;
}
.seefinish input[type="radio"]{
  display: none;
}
.Close {
  position: absolute;
  right: 10px;
  top: 10px;
  font-size: 20px;
}
.finishContent {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}
.finishbody {
  flex: 1;
  padding: 15px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
}
.title {
  height: 45px;
  line-height: 40px;
  font-size: 18px;
  text-align: center;
  font-weight: 600;
  padding-top: 25px;
}
.floot {
  width: 100%;
  width: 50px;
  line-height: 50px;
  width: 100%;
}
.floot p {
  flex: 1;
    color:#fff;
  background-color:#1890ff;
  text-align: center;
}
.floot p:first-child {
  background-color:#9a9a9a;
  color:#fff;
}
.el-form-item {
  margin-bottom: 10px !important;
}
.radiosListstSylke {
  padding: 10px 0;
}
.radiosListstSylke div {
  line-height: 22px;
}
.checkboxListstSylke {
  padding: 10px 0;
}
.checkboxListstSylke div {
  line-height: 22px;
}
.el-input__inner {
  height: 35px;
  line-height: 35px;
}
.timeData {
  width: 100%;
  height: 35px;
  line-height: 35px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  margin-top: 2px;
  box-sizing: border-box;
  padding: 0 10px;
}
#h-picker {
  z-index: 9999999999 !important;
}
.mbx button{
  border-radius:30px;
}
.mbx button span{
    font-size: 16px;
color:#fff!important;
}
.upload-demo button span{
  font-size: 16px;

}

</style>
<style lang="scss">
.el-input.is-disabled .el-input__inner {
  background-color: #F5F7FA;
    border-color: #E4E7ED;
    color: #000000;
    cursor: not-allowed;
    /* opacity: 1; */
}
.el-radio__input.is-disabled+span.el-radio__label {
    color: #000000;
    cursor: not-allowed;
}
.el-textarea.is-disabled .el-textarea__inner {
  background-color: #F5F7FA;
    border-color: #E4E7ED;
    color: #000000;
    cursor: not-allowed;
}

.el-checkbox__input.is-disabled+span.el-checkbox__label {
    color: #000000;
    cursor: not-allowed;
}
</style>
